package com.yanqu.road.server.cmd.activity.dunhuangshiku;

import com.yanqu.road.pb.dunhuangshiku.DunHuangShiKuProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.cross.battle.dunhuangshiku.DunHuangShiKuMgr;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Author cwq
 * @Date 2021/04/20
 */

@Cmd(code = CrossProtocol.C2_DUN_HUANG_SHI_KU_CANCEL_TEAM_APPLY, desc = "敦煌石窟取消队伍申请")
public class CrossDunHuangShiKuCancelTeamApplyCmd extends CrossUnionCommand {

    int activityId;
    long teamId;
    long userId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        DunHuangShiKuProto.DunHuangShiKuCancelTeamApplyReqMsg msg = DunHuangShiKuProto.DunHuangShiKuCancelTeamApplyReqMsg.parseFrom(packet.getBytes());
        activityId = msg.getActivityId();
        teamId = msg.getTeamId();
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId, YanQuMessageUtils.buildMessage(ClientProtocol.U_DUN_HUANG_SHI_KU_CANCEL_TEAM_APPLY, DunHuangShiKuMgr.cancelTeamApply(activityId,(int)teamId,userId)));
    }

    @Override
    public void sendData() {

    }
}
